package com.hxz.pojo;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
/**
 * @Description
 * @Author 86199
 * @Date 2021/3/26 16:10
 */
public class MyListener implements ApplicationListener {

    private MyListener(){
        System.out.println("MyListener构造器执行!");
    }

    //监听触发执行
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        Object source = applicationEvent.getSource();
        System.out.println("接受到事件传递的数据："+source);
        System.out.println("事件对象："+applicationEvent.getClass().getName());
        System.out.println("监听到了对应事件！");
    }
}